package cn.lingyangwl.agile.pay.model.rqrs.pay;

import cn.lingyangwl.agile.pay.model.bo.PaySignData;
import cn.lingyangwl.framework.sign.SignPayload;
import lombok.Data;

import java.io.Serializable;

/**
 * 接口抽象RS对象, 本身无需实例化
 *
 * @author shenguangyang
 */
@Data
public abstract class AbstractRS implements Serializable {
    /**
     * 签名值
     * @see PaySignData#KEY_SIGN
     */
    protected String sign;

    /**
     * 接口请求时间
     */
    protected String ts;

    /**
     * 签名随机数, 增加签名的多边性
     * @see PaySignData#KEY_NONCE
     */
    protected String nonce;

    /**
     * 密钥id
     */
    protected String secretId;

    protected String signType;

    public SignPayload buildSignPayload() {
        SignPayload signPayload = SignPayload.builder()
                .secretId(secretId).sign(sign).signType(signType).nonce(nonce).timeStamp(ts).build();
        signPayload.check();
        return signPayload;
    }
}
